import {Graph, RubberBandHandler, SelectionHandler} from "@maxgraph/core";

export default function (graph: Graph) {
    graph.setGridSize(5);
    // 橡皮筋
    new RubberBandHandler(graph);
    // 开启导航条
    const selectionHandler = graph.getPlugin('SelectionHandler') as SelectionHandler
    selectionHandler.guidesEnabled = true;
    // 设置平移没有预览
    selectionHandler.maxLivePreview = 1;
    // selectionHandler.guide
    // 双击编辑单元格文字
    graph.setCellsEditable(true);
    // 右键滑动平移
    graph.setPanning(true);
    graph.useScrollbarsForPanning = true;

    graph.setConnectable(true);
    graph.setPortsEnabled(false);
    // 不允许自我连线
    graph.setAllowLoops(false);
    // 不允许把线从节点上拖出来
    graph.setDisconnectOnMove(false);
}